package operator.filter;

import io.reactivex.CompletableObserver;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import util.Printer;

class IgnoreElementsOperator {

    public static void main(String[] args) {
        ignoreElements();
    }


    /**
     * 只允许它的终止通知（onError或onCompleted）通过
     */
    static void ignoreElements(){
        Observable.just(1, 2)
                .ignoreElements()
                .subscribe(new CompletableObserver() {
                    @Override
                    public void onSubscribe(Disposable disposable) {
                        Printer.print("ignoreElements onSubscribe");
                    }

                    @Override
                    public void onComplete() {
                        Printer.print("ignoreElements onComplete");
                    }

                    @Override
                    public void onError(Throwable throwable) {
                        Printer.print("ignoreElements onError throwable = " + throwable);
                    }
                });
    }


}
